/*
 *  Netzpult - Your desk on the web
 *  Copyright (C) 2011  Ulrich Hilger, http://uhilger.de
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see http://www.gnu.org/licenses/
 */

package de.uhilger.netzpult.client;

/**
 * A parameter in the form of a key/value pair.
 *
 * @author Copyright (c) Ulrich Hilger, http://uhilger.de
 * @author Published under the terms and conditions of
 * the <a href="http://www.gnu.org/licenses/" target="_blank">GNU General Public License</a>
 */
public class Parameter {
  
  private String key;
  private String value;

  /**
   * Create a new object of class Parameter
   */
  public Parameter() {
    super();
  }

  /**
   * Create a new object of class Parameter
   * @param key  the key this parameter is to have
   * @param value  the value this parameter is to have
   */
  public Parameter(String key, String value) {
    this();
    this.key = key;
    this.value = value;
  }

  /**
   * Get the key of this parameter
   * @return  the key
   */
  public String getKey() {
    return key;
  }

  /**
   * Set the key of this parameter
   * @param key  the key
   */
  public void setKey(String key) {
    this.key = key;
  }

  /**
   * Get the value of this parameter
   * @return  the value
   */
  public String getValue() {
    return value;
  }

  /**
   * Set the value of this parameter
   * @param value  the value
   */
  public void setValue(String value) {
    this.value = value;
  }

  /**
   * Determine whether this object is equal to another object
   * @param obj  the object to compare this object to
   * @return  true, when this object is equal to the given object, false if not
   */
  @Override
  public boolean equals(Object obj) {
    boolean isEqual = false;
    if(obj != null && obj instanceof Parameter) {
      Parameter other = (Parameter) obj;
      isEqual = this.getKey().equals(other.getKey());
    }
    return isEqual;
  }

  /**
   * Get the hash code of this object
   * @return  the hash code
   */
  @Override
  public int hashCode() {
    int hash = 3;
    hash = 71 * hash + (this.key != null ? this.key.hashCode() : 0);
    return hash;
  }



}
